<template>
  <el-dialog
    title="试卷详细信息"
    :visible.sync="isOpen"
    width="50%"
    append-to-body
    :destroy-on-close="true"
  >
    <el-descriptions class="margin-top" :column="4" border>
      <el-descriptions-item label="试卷名称" :span="4">{{paperInfo.paperName}}</el-descriptions-item>
      <el-descriptions-item label="试卷描述" :span="4">{{paperInfo.paperDesc}}</el-descriptions-item>
      <el-descriptions-item label="考试状态" :span="2">
        <dict-tag :options="dict.type.paper_status" :value="paperInfo.paperStatus" />
      </el-descriptions-item>
      <el-descriptions-item label="开始时间" :span="2">
        <span>{{ parseTime(paperInfo.paperStartTime, '{y}-{m}-{d} {h}:{i}') }}</span>
      </el-descriptions-item>
      <el-descriptions-item label="结束时间" :span="2">
        <span>{{ parseTime(paperInfo.paperEndTime, '{y}-{m}-{d} {h}:{i}') }}</span>
      </el-descriptions-item>
      <el-descriptions-item label="当前试卷总分" :span="2">{{paperInfo.paperNowScore}}</el-descriptions-item>
      <el-descriptions-item label="合格分数" :span="2">{{paperInfo.paperPassScore}}</el-descriptions-item>
      <el-descriptions-item label="考试时长" :span="2">{{paperInfo.paperDuration}}分钟</el-descriptions-item>
      <el-descriptions-item label="题目是否乱序" :span="2">
        <dict-tag :options="dict.type.paper_upset" :value="paperInfo.paperQuUpset" />
      </el-descriptions-item>
      <el-descriptions-item label="选项是否乱序" :span="2">
        <dict-tag :options="dict.type.paper_upset" :value="paperInfo.paperOptionsUpset" />
      </el-descriptions-item>
      <el-descriptions-item label="创建时间" :span="2">
        <span>{{ parseTime(paperInfo.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
      </el-descriptions-item>
      <el-descriptions-item label="更新时间" :span="2">
        <span>{{ parseTime(paperInfo.updateTime, '{y}-{m}-{d} {h}:{i}') }}</span>
      </el-descriptions-item>
    </el-descriptions>
    <div slot="footer" class="dialog-footer">
      <el-button @click="isOpen=false">取 消</el-button>
    </div>
  </el-dialog>
</template>
    
  <script>
export default {
  name: "PaperInfo",
  dicts: ["paper_status", "paper_upset"],
  props: {
    // 数据
    paperData: {
      type: Object,
      default: {}
    },
    // 是否展开
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      paperInfo: {}
    };
  },
  computed: {
    isOpen: {
      get() {
        return this.visible;
      },
      set(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  watch: {
    // 监听数据变化
    paperData(newVal, oldVal) {
      this.paperInfo = newVal;
    }
  }
};
</script>
    
  <style scoped>
.imgSize {
  height: 54px;
  width: 96px;
  margin-left: 5px;
  margin-right: 5px;
}
</style>